<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  
  <title>Hust Oj搭建的历程 | 探花需拔根</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
    <meta name="keywords" content="Bluarry,bluarry,Blog,探花,拔根,博客,区块链,算法,acm">
  
  <meta name="description" content="简介: 闲的蛋疼瞎折腾">
<meta name="keywords" content="学习,linux,onlinejudge">
<meta property="og:type" content="article">
<meta property="og:title" content="Hust Oj搭建的历程">
<meta property="og:url" content="/2017/05/12/Hust-Oj搭建的历程/index.html">
<meta property="og:site_name" content="探花需拔根">
<meta property="og:description" content="简介: 闲的蛋疼瞎折腾">
<meta property="og:locale" content="zh.yml">
<meta property="og:image" content="/img/uploads/hustoj/hustoj.png">
<meta property="og:image" content="/img/uploads/hustoj/judge.conf.jpg">
<meta property="og:image" content="/img/uploads/hustoj/nginx_config.jpg">
<meta property="og:image" content="/img/uploads/hustoj/theam_oj.jpg">
<meta property="og:updated_time" content="2020-06-19T12:58:16.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hust Oj搭建的历程">
<meta name="twitter:description" content="简介: 闲的蛋疼瞎折腾">
<meta name="twitter:image" content="/img/uploads/hustoj/hustoj.png">
  
  
    <link rel="icon" href="/favicon.ico">
  
  <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/css/style.css">
  <script src="/js/pace.min.js"></script>
  

  
  

  
<!-- Matomo -->
<script type="text/javascript">
	var _paq = window._paq || [];
	/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
	_paq.push(['trackPageView']);
	_paq.push(['enableLinkTracking']);
	(function() {
	  var u="//matomo.bluarry.top/";
	  _paq.push(['setTrackerUrl', u+'matomo.php']);
	  _paq.push(['setSiteId', '3']);
	  var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
	  g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
	})();
  </script>
  <!-- End Matomo Code -->

</head>
</html>
<body>
  <div id="container">
      <header id="header">
    <div id="banner"></div>
    <div id="header-outer">
        <div id="header-menu" class="header-menu-pos animated">
            <div class="header-menu-container">
                <a href="/" class="left">
                    <span class="site-title">探花需拔根</span>
                </a>
                <nav id="header-menu-nav" class="right">
                    
                    <a  href="/">
                        <i class="fa fa-home"></i>
                        <span>主页</span>
                    </a>
                    
                    <a  href="/archives">
                        <i class="fa fa-archive"></i>
                        <span>归档</span>
                    </a>
                    
                    <a  href="/friends">
                        <i class="fa fa-envira"></i>
                        <span>友链</span>
                    </a>
                    
                    <a  href="/about">
                        <i class="fa fa-user"></i>
                        <span>关于我</span>
                    </a>
                    
                </nav>
                <a class="mobile-header-menu-button">
                    <i class="fa fa-bars"></i>
                </a>
            </div>
        </div>
        <div id="header-row">
            <div id="logo">
                <a href="/">
                    <img src="/images/avatar/me-130x130.jpg" alt="logo">
                </a>
            </div>
            <div class="header-info">
                <div id="header-title">
                    
                    <h2>
                        清风觅影
                    </h2>
                    
                </div>
                <div id="header-description">
                    
                    <h3>
                        致需极,守静笃
                    </h3>
                    
                </div>
            </div>
            <nav class="header-nav">
                <div class="social">
                    
                        <a title="Home"  href="/">
                            <i class="fa fa-home fa-2x"></i></a>
                    
                        <a title="Github" target="_blank" href="//github.com/bluarry">
                            <i class="fa fa-github fa-2x"></i></a>
                    
                        <a title="mail" target="_blank" href="mailto://bluarry@qq.com">
                            <i class="fa fa-envelope-o fa-2x"></i></a>
                    
                </div>
            </nav>
        </div>
    </div>
</header>
      <div class="outer">
        <section id="main" class="body-wrap"><article id="post-Hust-Oj搭建的历程" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-inner">
    
      <header class="article-header">
        
  
    <h1 class="post-title" itemprop="name">
      Hust Oj搭建的历程
    </h1>
    <div class="post-title-bar">
      <ul>
          
              <li>
                  <i class="fa fa-book"></i>
                  
                      <a href="/categories/linux学习acmonlinejudgehustoj/">linux 学习 acm onlinejudge hustoj</a>
                  
              </li>
          
        <li>
          <i class="fa fa-calendar"></i>  2017-05-12
        </li>
        <li>
          <i class="fa fa-eye"></i>
          <span id="busuanzi_value_page_pv"></span>
        </li>
      </ul>
    </div>
  

          
      </header>
    
    <div class="article-entry post-content" itemprop="articleBody">
      
            
            <blockquote>
<p>简介: 闲的蛋疼瞎折腾<br><a id="more"></a></p>
<h1 id="Hustonline-Judge-搭建的辛苦历程"><a href="#Hustonline-Judge-搭建的辛苦历程" class="headerlink" title="Hustonline Judge 搭建的辛苦历程"></a>Hustonline Judge 搭建的辛苦历程</h1><p><img src="/img/uploads/hustoj/hustoj.png" alt="hustoj"></p>
</blockquote>
<h1 id="事实上我也不知道为啥我一定要自己搭建一个onlinejudge-我其实是想了解呀一下onlinejudge的原理-顺便利用开源的hustoj来搭建一个oj"><a href="#事实上我也不知道为啥我一定要自己搭建一个onlinejudge-我其实是想了解呀一下onlinejudge的原理-顺便利用开源的hustoj来搭建一个oj" class="headerlink" title="事实上我也不知道为啥我一定要自己搭建一个onlinejudge.我其实是想了解呀一下onlinejudge的原理,顺便利用开源的hustoj来搭建一个oj"></a>事实上我也不知道为啥我一定要自己搭建一个onlinejudge.<br>我其实是想了解呀一下onlinejudge的原理,顺便利用开源的hustoj来搭建一个oj</h1><h1 id="以下的链接可以了解到acm的onlinejudge的原理及其工作方式-传送门"><a href="#以下的链接可以了解到acm的onlinejudge的原理及其工作方式-传送门" class="headerlink" title="以下的链接可以了解到acm的onlinejudge的原理及其工作方式 :传送门"></a>以下的链接可以了解到acm的onlinejudge的原理及其工作方式 :<br><a href="https://github.com/ma6174/acmjudger" target="_blank" rel="noopener">传送门</a></h1><h1 id="以下是我搭建oj的过程-要求Ubuntu来实现-如要用centos等-需看官方的安装方式"><a href="#以下是我搭建oj的过程-要求Ubuntu来实现-如要用centos等-需看官方的安装方式" class="headerlink" title="以下是我搭建oj的过程:(要求Ubuntu来实现,如要用centos等,需看官方的安装方式)"></a>以下是我搭建oj的过程:(要求Ubuntu来实现,如要用centos等,需看官方的安装方式)</h1><p><br></p>
<h2 id="1-首先创建一个用户"><a href="#1-首先创建一个用户" class="headerlink" title="1. 首先创建一个用户"></a>1. 首先创建一个用户</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo  /usr/sbin/useradd -m -u 1536 judge</span><br></pre></td></tr></table></figure>
<h2 id="2-需要用lnmp环境来搭建oj-故先安装lnmp"><a href="#2-需要用lnmp环境来搭建oj-故先安装lnmp" class="headerlink" title="2.需要用lnmp环境来搭建oj,故先安装lnmp"></a>2.需要用lnmp环境来搭建oj,故先安装lnmp</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt-get install make flex g++ clang libmysqlclient-dev libmysql++-dev php5-fpm nginx mysql-server php5-mysql php5-gd php5-cli fp-compiler openjdk-7-jdk</span><br></pre></td></tr></table></figure>
<h2 id="3-搭建好后确保自己的服务器的mysql-nginx正常使用-端口正常开放-可能用到以下命令"><a href="#3-搭建好后确保自己的服务器的mysql-nginx正常使用-端口正常开放-可能用到以下命令" class="headerlink" title="3.搭建好后确保自己的服务器的mysql,nginx正常使用,端口正常开放,可能用到以下命令"></a>3.搭建好后确保自己的服务器的mysql,nginx正常使用,端口正常开放,可能用到以下命令</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">netstat -lnt</span><br></pre></td></tr></table></figure>
<h2 id="4-将源码从远程仓库svn到本地src目录下"><a href="#4-将源码从远程仓库svn到本地src目录下" class="headerlink" title="4.将源码从远程仓库svn到本地src目录下"></a>4.将源码从远程仓库svn到本地src目录下</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">svn co https://github.com/zhblue/hustoj/trunk/trunk src</span><br></pre></td></tr></table></figure>
<h2 id="5-需要从db-sql导入数据库-你可能需要创建数据库用户及数据库操作-请移步文章尾部-此处默认使用root用户"><a href="#5-需要从db-sql导入数据库-你可能需要创建数据库用户及数据库操作-请移步文章尾部-此处默认使用root用户" class="headerlink" title="5.需要从db.sql导入数据库,你可能需要创建数据库用户及数据库操作,请移步文章尾部,此处默认使用root用户"></a>5.需要从db.sql导入数据库,你可能需要创建数据库用户及数据库操作,请移步文章尾部,此处默认使用root用户</h2><blockquote>
<p>1.首先确定db.sql文件没有错误,可vim db.sql排错<br>2.登入数据库<br>3.接下来输入密码即可</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">sudo mysql -uroot -p  </span><br><span class="line">```     </span><br><span class="line">&gt; 4,查看数据库</span><br><span class="line"></span><br><span class="line">```bash</span><br><span class="line">show databases;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>5.导入数据库文件           </p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">source</span> db.sql;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>6.使用导入的数据库         </p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">use jol;       </span><br><span class="line">insert into privilege values(<span class="string">'username'</span>,<span class="string">'administrator'</span>,<span class="string">'N'</span>);   //其中的username为将来oj的管理员用户名</span><br></pre></td></tr></table></figure>
<h2 id="6-创建目录及一些必要的配置文件"><a href="#6-创建目录及一些必要的配置文件" class="headerlink" title="6.创建目录及一些必要的配置文件"></a>6.创建目录及一些必要的配置文件</h2><blockquote>
<p>1.首先来到源码的install目录下可参考文件install-interactive.sh</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">sudo    mkdir /home/judge</span><br><span class="line">sudo    mkdir /home/judge/etc</span><br><span class="line">sudo    mkdir /home/judge/data</span><br><span class="line">sudo    mkdir /home/judge/<span class="built_in">log</span></span><br><span class="line">sudo    mkdir /home/judge/run0</span><br><span class="line">sudo    mkdir /home/judge/run1</span><br><span class="line">sudo    mkdir /home/judge/run2</span><br><span class="line">sudo    mkdir /home/judge/run3</span><br><span class="line">sudo cp java0.policy  judge.conf /home/judge/etc</span><br></pre></td></tr></table></figure>
<blockquote>
<p>2.此时进入所创建的目录配置judge.conf文件<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /home/etc/judge.conf</span><br></pre></td></tr></table></figure></p>
</blockquote>
<p>主要设置包括如下<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">1. password</span><br><span class="line">2. oj_running =1</span><br><span class="line">3.sleep_time=1</span><br><span class="line">4.oj_shm_run=0</span><br><span class="line">5. lang=0,1,2,3</span><br></pre></td></tr></table></figure></p>
<p><img src="/img/uploads/hustoj/judge.conf.jpg" alt="judge.conf"></p>
<h2 id="7-编译judge端"><a href="#7-编译judge端" class="headerlink" title="7.编译judge端"></a>7.编译judge端</h2><blockquote>
<p>进入src的core目录下makejudged<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ./make,sh</span><br></pre></td></tr></table></figure></p>
</blockquote>
<p>为了确认make是否成功可检测/etc/bin目录下是否有judged<br>运行judged如下方式<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">judged</span><br><span class="line">ps aux|grep judge</span><br></pre></td></tr></table></figure></p>
<blockquote>
<p>此时judge端配置完成</p>
<h2 id="8-配置前端"><a href="#8-配置前端" class="headerlink" title="8.配置前端"></a>8.配置前端</h2><p>1.配置nginx,配置文件在/etc/nginx/site-enable/default<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/nginx/sites_enable/default</span><br></pre></td></tr></table></figure></p>
</blockquote>
<p><img src="/img/uploads/hustoj/nginx_config.jpg" alt="nginx_config"></p>
<blockquote>
<p>更改根目录(我配置到了/home/judge/etc/web/),取消对php支持的注释…and so on.<br>最后重启nginx</p>
</blockquote>
<h2 id="9-配置include-db-info-config-php相应的mysql信息-到此你可以注册用户了-注意先注册-第6条所输入的管理员-之后即可管理"><a href="#9-配置include-db-info-config-php相应的mysql信息-到此你可以注册用户了-注意先注册-第6条所输入的管理员-之后即可管理" class="headerlink" title="9.配置include/db_info_config.php相应的mysql信息. 到此你可以注册用户了,注意先注册 第6条所输入的管理员,之后即可管理"></a>9.配置include/db_info_config.php相应的mysql信息. 到此你可以注册用户了,注意先注册 第6条所输入的管理员,之后即可管理</h2><h2 id="最后管理时可能出现的问题-什么上传时限制大小啊等等"><a href="#最后管理时可能出现的问题-什么上传时限制大小啊等等" class="headerlink" title="最后管理时可能出现的问题 什么上传时限制大小啊等等"></a>最后管理时可能出现的问题 什么上传时限制大小啊等等</h2><blockquote>
<p>首先是限制大小,需要修改php.ini的upload_maxk…具体可百度到,这里不列举了<br>还有nginx的限制上传的大小,可百度<br>最后是目录权限问题,尝试一下命令解决,需要在nginx的网页根目录下<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">chown www-data upload</span><br><span class="line">chown www-data /home/judge/upload/data</span><br></pre></td></tr></table></figure></p>
</blockquote>
<h2 id="最后就是涉及到了主题的修改，网站模板在web-template下的sb-我使用的-，默认为sb3，可自行修改，这里不做赘述"><a href="#最后就是涉及到了主题的修改，网站模板在web-template下的sb-我使用的-，默认为sb3，可自行修改，这里不做赘述" class="headerlink" title="最后就是涉及到了主题的修改，网站模板在web/template下的sb(我使用的)，默认为sb3，可自行修改，这里不做赘述"></a>最后就是涉及到了主题的修改，网站模板在web/template下的sb(我使用的)，默认为sb3，可自行修改，这里不做赘述</h2><p><img src="/img/uploads/hustoj/theam_oj.jpg" alt="theme"></p>
<h1 id="附加一些数据库操作-可能会用到"><a href="#附加一些数据库操作-可能会用到" class="headerlink" title="附加一些数据库操作,可能会用到"></a>附加一些数据库操作,可能会用到</h1><blockquote>
<p>创建一个数据库abccs<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">CREATE DATABASE abccs;</span><br></pre></td></tr></table></figure></p>
<p>删除数据库:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">drop database 数据库名字，</span><br></pre></td></tr></table></figure></p>
<p>一, 创建用户:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">CREATE USER <span class="string">'username'</span>@<span class="string">'host'</span> IDENTIFIED BY <span class="string">'password'</span>;</span><br><span class="line">例子: CREATE USER <span class="string">'dog'</span>@<span class="string">'localhost'</span> IDENTIFIED BY <span class="string">'123456'</span>;</span><br></pre></td></tr></table></figure></p>
<p>授权用户:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">命令:GRANT privileges ON databasename.tablename TO <span class="string">'username'</span>@<span class="string">'host'</span>；</span><br><span class="line">例子 GRANT ALL ON *.* TO <span class="string">'pig'</span>@<span class="string">'%'</span>;</span><br></pre></td></tr></table></figure></p>
<p>三.设置与更改用户密码<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">命令:SET PASSWORD FOR <span class="string">'username'</span>@<span class="string">'host'</span> = PASSWORD(<span class="string">'newpassword'</span>);如果是当前登陆用户用SET PASSWORD = PASSWORD(<span class="string">"newpassword"</span>);</span><br></pre></td></tr></table></figure></p>
<p>五.删除用户<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">命令: DROP USER <span class="string">'username'</span>@<span class="string">'host'</span>;</span><br></pre></td></tr></table></figure></p>
<p>清空全部数据，不写日志，不可恢复，速度极快<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">truncate table 表名;</span><br></pre></td></tr></table></figure></p>
</blockquote>

            <div class="post-copyright">
    <div class="content">
        <p>最后更新： 2020年06月19日 20:58</p>
        <p>原始链接： <a class="post-url" href="/2017/05/12/Hust-Oj搭建的历程/" title="Hust Oj搭建的历程">/2017/05/12/Hust-Oj搭建的历程/</a></p>
        <footer>
            <a href="">
                <img src="/images/avatar/me-130x130.jpg" alt="bluarry">
                bluarry
            </a>
        </footer>
    </div>
</div>

      
        
            
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;">赏</a>
</div>

<div id="reward" class="post-modal reward-lay">
    <a class="close" href="javascript:;" id="reward-close">×</a>
    <span class="reward-title">
        <i class="icon icon-quote-left"></i>
        请我吃糖~
        <i class="icon icon-quote-right"></i>
    </span>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/images/wechat_code.jpg" alt="打赏二维码">
        </div>
        <div class="reward-select">
            
            <label class="reward-select-item checked" data-id="wechat" data-wechat="/images/wechat_code.jpg">
                <img class="reward-select-item-wechat" src="/images/wechat.png" alt="微信">
            </label>
            
            
            <label class="reward-select-item" data-id="alipay" data-alipay="/images/alipay_code.jpg">
                <img class="reward-select-item-alipay" src="/images/alipay.png" alt="支付宝">
            </label>
            
        </div>
    </div>
</div>


        
    </div>
    <footer class="article-footer">
        
        
<div class="post-share">
    <a href="javascript:;" id="share-sub" class="post-share-fab">
        <i class="fa fa-share-alt"></i>
    </a>
    <div class="post-share-list" id="share-list">
        <ul class="share-icons">
          <li>
            <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=/2017/05/12/Hust-Oj搭建的历程/&title=《Hust Oj搭建的历程》 — 探花需拔根&pic=images/avatar/me-130x130.jpg" data-title="微博">
              <i class="fa fa-weibo"></i>
            </a>
          </li>
          <li>
            <a class="weixin share-sns" id="wxFab" href="javascript:;" data-title="微信">
              <i class="fa fa-weixin"></i>
            </a>
          </li>
          <li>
            <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=/2017/05/12/Hust-Oj搭建的历程/&title=《Hust Oj搭建的历程》 — 探花需拔根&source=
简介: 闲的蛋疼瞎折腾" data-title="QQ">
              <i class="fa fa-qq"></i>
            </a>
          </li>
          <li>
            <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=/2017/05/12/Hust-Oj搭建的历程/" data-title="Facebook">
              <i class="fa fa-facebook"></i>
            </a>
          </li>
          <li>
            <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《Hust Oj搭建的历程》 — 探花需拔根&url=/2017/05/12/Hust-Oj搭建的历程/&via=" data-title="Twitter">
              <i class="fa fa-twitter"></i>
            </a>
          </li>
          <li>
            <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=/2017/05/12/Hust-Oj搭建的历程/" data-title="Google+">
              <i class="fa fa-google-plus"></i>
            </a>
          </li>
        </ul>
     </div>
</div>
<div class="post-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;" id="wxShare-close">×</a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>

<div class="mask"></div>

        
        <ul class="article-footer-menu">
            
            
  <li class="article-footer-tags">
    <i class="fa fa-tags"></i>
      
    <a href="/tags/学习/" class="color3">学习</a>
      
    <a href="/tags/linux/" class="color1">linux</a>
      
    <a href="/tags/onlinejudge/" class="color2">onlinejudge</a>
      
  </li>

        </ul>
        
        

    <aside class="post-toc-pos post-toc-top" id="post-toc">
        <nav class="post-toc-wrap">
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#Hustonline-Judge-搭建的辛苦历程"><span class="post-toc-text">Hustonline Judge 搭建的辛苦历程</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#事实上我也不知道为啥我一定要自己搭建一个onlinejudge-我其实是想了解呀一下onlinejudge的原理-顺便利用开源的hustoj来搭建一个oj"><span class="post-toc-text">事实上我也不知道为啥我一定要自己搭建一个onlinejudge.我其实是想了解呀一下onlinejudge的原理,顺便利用开源的hustoj来搭建一个oj</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#以下的链接可以了解到acm的onlinejudge的原理及其工作方式-传送门"><span class="post-toc-text">以下的链接可以了解到acm的onlinejudge的原理及其工作方式 :传送门</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#以下是我搭建oj的过程-要求Ubuntu来实现-如要用centos等-需看官方的安装方式"><span class="post-toc-text">以下是我搭建oj的过程:(要求Ubuntu来实现,如要用centos等,需看官方的安装方式)</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#1-首先创建一个用户"><span class="post-toc-text">1. 首先创建一个用户</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#2-需要用lnmp环境来搭建oj-故先安装lnmp"><span class="post-toc-text">2.需要用lnmp环境来搭建oj,故先安装lnmp</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#3-搭建好后确保自己的服务器的mysql-nginx正常使用-端口正常开放-可能用到以下命令"><span class="post-toc-text">3.搭建好后确保自己的服务器的mysql,nginx正常使用,端口正常开放,可能用到以下命令</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#4-将源码从远程仓库svn到本地src目录下"><span class="post-toc-text">4.将源码从远程仓库svn到本地src目录下</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#5-需要从db-sql导入数据库-你可能需要创建数据库用户及数据库操作-请移步文章尾部-此处默认使用root用户"><span class="post-toc-text">5.需要从db.sql导入数据库,你可能需要创建数据库用户及数据库操作,请移步文章尾部,此处默认使用root用户</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#6-创建目录及一些必要的配置文件"><span class="post-toc-text">6.创建目录及一些必要的配置文件</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#7-编译judge端"><span class="post-toc-text">7.编译judge端</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#8-配置前端"><span class="post-toc-text">8.配置前端</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#9-配置include-db-info-config-php相应的mysql信息-到此你可以注册用户了-注意先注册-第6条所输入的管理员-之后即可管理"><span class="post-toc-text">9.配置include/db_info_config.php相应的mysql信息. 到此你可以注册用户了,注意先注册 第6条所输入的管理员,之后即可管理</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#最后管理时可能出现的问题-什么上传时限制大小啊等等"><span class="post-toc-text">最后管理时可能出现的问题 什么上传时限制大小啊等等</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#最后就是涉及到了主题的修改，网站模板在web-template下的sb-我使用的-，默认为sb3，可自行修改，这里不做赘述"><span class="post-toc-text">最后就是涉及到了主题的修改，网站模板在web/template下的sb(我使用的)，默认为sb3，可自行修改，这里不做赘述</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#附加一些数据库操作-可能会用到"><span class="post-toc-text">附加一些数据库操作,可能会用到</span></a></li></ol>
        </nav>
    </aside>
    

<nav id="article-nav">
  
    <a href="/2017/07/22/2017-07-22-腾讯2015复试面试题--易碎的鸟蛋/" id="article-nav-newer" class="article-nav-link-wrap">

      <span class="article-nav-title">
        <i class="fa fa-hand-o-left" aria-hidden="true"></i>
        
          腾讯2015复试面试题--易碎的鸟蛋
        
      </span>
    </a>
  
  
    <a href="/2017/01/25/kalilinux安装ss-qt5/" id="article-nav-older" class="article-nav-link-wrap">
      <span class="article-nav-title">Kali Linux 下安装 ss-qt5</span>
      <i class="fa fa-hand-o-right" aria-hidden="true"></i>
    </a>
  
</nav>




    <!-- HTML页面布局 -->
    <div id="tab-list">
        <ul id="ul1">
            
            
            
            <li id="gittalk" style="width: 25%;">gittalk</li>
            
            
            <li id="valine" style="width: 25%;">valine</li>
            
        </ul>
         
        
          
        <div id="dv_gitment" class="hide">
            <div id="git_comments"></div>;
        </div>
        
        
        <div id="dv_vment" class="show">
            <div class="comments vcomment" id="vcomments"></div>
        </div>
        
    </div>

    <script src="/js/tablist.js"></script>
   

    
        
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script src="https://cdn.bluarry.top/cdn/js/md5.min.js"></script>
<!--<div id="git_comments"></div>-->
<script>
    // var gitment = new Gitment({
    //     owner: 'bluarry',
    //     repo: 'blog_comment',
    //     oauth: {
    //         client_id: '5c95f5b820d109c8f5c1',
    //         client_secret: 'f1cfe5b08f9a55923ba26a9ec8855b631002ad18',
    //     },
    // })
    var hrefs=location.href;
    var links=hrefs.split('/');
    var cr="";
    for (var i=0;i<Math.min(7,links.length);i++) {
        cr+=links[i];
    }
    console.log(cr);

    var gitalk = new Gitalk({
        clientID: '5c95f5b820d109c8f5c1', //Client ID
        clientSecret: 'f1cfe5b08f9a55923ba26a9ec8855b631002ad18', //Client Secret
        repo: 'blog_comment',//仓库名称
        owner: 'bluarry',//仓库拥有者
        admin: ['bluarry'],
        id: md5(cr),      // Ensure uniqueness and length less than 50
        distractionFreeMode: false  // Facebook-like distraction free mode
    });
    gitalk.render('git_comments');
</script>


    
        <!-- Valine Comments -->
<!-- <div class="comments vcomment" id="vcomments"></div>-->
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script>
<!-- Valine Comments script -->
<script>
    var GUEST_INFO = ['nick','mail','link'];
    var guest_info = 'nick,mail'.split(',').filter(function(item){
        return GUEST_INFO.indexOf(item) > -1
    });
    new Valine({
        el: '#vcomments',
        notify: 'true' == 'true',
        verify: 'false' == 'true',
        appId: "DRrkhLYTmB6QwGy6sI6vCH8C-gzGzoHsz",
        appKey: "M4A4lrKwbixQmmeO5lVdY5l2",
        avatar: "mm",
        placeholder: "少侠，留下你的评论吧",
        guest_info: guest_info.length == 0 ? GUEST_INFO : guest_info,
        pageSize: "10"
    })
</script>
<!-- Valine Comments end -->

    


    </footer>
  </div>
</article>


</section>
        
      </div>
      <footer id="footer">
  <div class="outer">
    <div id="footer-info" class="inner">
      
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        <i class="fa fa-user"></i>&nbsp;&nbsp;<span id="busuanzi_value_site_uv"></span>
    </span>&nbsp;&nbsp;|&nbsp;&nbsp;
    <span id="busuanzi_container_site_pv" style='display:none'>
        <i class="fa fa-eye"></i> &nbsp;&nbsp;<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


      <p>
      &copy; 2016-2021 &nbsp;&nbsp;<i style="color: red;" class="fa fa-heart"></i>&nbsp;&nbsp; bluarry
      备案号: <a style="color: #999;" href="http://www.beian.miit.gov.cn/" target="_blank">陕ICP备2020012959号</a>
    </p>

    </div>
  </div>
</footer>
    <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
  var mihoConfig = {
      root: "",
      animate: true,
      isHome: false,
      share: true,
      reward: 1
  }
</script>
<div class="sidebar">
    <div id="sidebar-search" title="Search">
        <i class="fa fa-search"></i>
    </div>
    <div id="sidebar-category" title="Categories">
        <i class="fa fa-book"></i>
    </div>
    <div id="sidebar-tag" title="Tags">
        <i class="fa fa-tags"></i>
    </div>
    <div id="sidebar-top">
        <span class="sidebar-top-icon"><i class="fa fa-angle-up"></i></span>
    </div>
</div>
<div class="sidebar-menu-box" id="sidebar-menu-box">
    <div class="sidebar-menu-box-container">
        <div id="sidebar-menu-box-categories">
            <a class="category-link" href="/categories/linux/">linux</a><a class="category-link" href="/categories/linux-学习/">linux 学习</a><a class="category-link" href="/categories/linux-学习-acm-onlinejudge-hustoj/">linux 学习 acm onlinejudge hustoj</a><a class="category-link" href="/categories/学习分享/">学习分享</a><a class="category-link" href="/categories/数据结构/">数据结构</a><a class="category-link" href="/categories/经验分享/">经验分享</a><a class="category-link" href="/categories/经验分享/学习分享/">学习分享</a><a class="category-link" href="/categories/默认分类/">默认分类</a><a class="category-link" href="/categories/默认分类/复习/">复习</a><a class="category-link" href="/categories/默认分类/复习/学习分享/">学习分享</a><a class="category-link" href="/categories/默认分类/学习分享/">学习分享</a><a class="category-link" href="/categories/默认分类/生活杂谈/">生活杂谈</a><a class="category-link" href="/categories/默认分类/经验分享/">经验分享</a><a class="category-link" href="/categories/默认分类/经验分享/学习分享/">学习分享</a>
        </div>
        <div id="sidebar-menu-box-tags">
            <a href="/tags/Java/" style="font-size: 10px;">Java</a> <a href="/tags/acm/" style="font-size: 12.86px;">acm</a> <a href="/tags/android/" style="font-size: 11.43px;">android</a> <a href="/tags/c/" style="font-size: 14.29px;">c++</a> <a href="/tags/fabric/" style="font-size: 11.43px;">fabric</a> <a href="/tags/kali/" style="font-size: 10px;">kali</a> <a href="/tags/linux/" style="font-size: 15.71px;">linux</a> <a href="/tags/linux学习/" style="font-size: 10px;">linux学习</a> <a href="/tags/mac/" style="font-size: 10px;">mac</a> <a href="/tags/mfc/" style="font-size: 10px;">mfc</a> <a href="/tags/onlinejudge/" style="font-size: 10px;">onlinejudge</a> <a href="/tags/sqlite/" style="font-size: 10px;">sqlite</a> <a href="/tags/sqlite3/" style="font-size: 11.43px;">sqlite3</a> <a href="/tags/ss/" style="font-size: 10px;">ss</a> <a href="/tags/vs/" style="font-size: 11.43px;">vs</a> <a href="/tags/xposed/" style="font-size: 10px;">xposed</a> <a href="/tags/xposed模块/" style="font-size: 10px;">xposed模块</a> <a href="/tags/专业知识/" style="font-size: 10px;">专业知识</a> <a href="/tags/侧链/" style="font-size: 10px;">侧链</a> <a href="/tags/内网穿透/" style="font-size: 10px;">内网穿透</a> <a href="/tags/区块链/" style="font-size: 11.43px;">区块链</a> <a href="/tags/复习/" style="font-size: 10px;">复习</a> <a href="/tags/学习/" style="font-size: 18.57px;">学习</a> <a href="/tags/安卓/" style="font-size: 12.86px;">安卓</a> <a href="/tags/小技巧/" style="font-size: 17.14px;">小技巧</a> <a href="/tags/数据库/" style="font-size: 10px;">数据库</a> <a href="/tags/数据结构/" style="font-size: 10px;">数据结构</a> <a href="/tags/日常使用问题/" style="font-size: 10px;">日常使用问题</a> <a href="/tags/最小生成树/" style="font-size: 11.43px;">最小生成树</a> <a href="/tags/最短路径/" style="font-size: 10px;">最短路径</a> <a href="/tags/比特币/" style="font-size: 11.43px;">比特币</a> <a href="/tags/算法/" style="font-size: 12.86px;">算法</a> <a href="/tags/算法笔记/" style="font-size: 11.43px;">算法笔记</a> <a href="/tags/经验/" style="font-size: 20px;">经验</a> <a href="/tags/编译原理/" style="font-size: 10px;">编译原理</a> <a href="/tags/翻译/" style="font-size: 10px;">翻译</a> <a href="/tags/自然计算/" style="font-size: 10px;">自然计算</a>
        </div>
    </div>
    <a href="javascript:;" class="sidebar-menu-box-close">&times;</a>
</div>
<div class="mobile-header-menu-nav" id="mobile-header-menu-nav">
    <div class="mobile-header-menu-container">
        <span class="title">Menus</span>
        <ul class="mobile-header-menu-navbar">
            
            <li>
                <a  href="/">
                    <i class="fa fa-home"></i><span>主页</span>
                </a>
            </li>
            
            <li>
                <a  href="/archives">
                    <i class="fa fa-archive"></i><span>归档</span>
                </a>
            </li>
            
            <li>
                <a  href="/friends">
                    <i class="fa fa-envira"></i><span>友链</span>
                </a>
            </li>
            
            <li>
                <a  href="/about">
                    <i class="fa fa-user"></i><span>关于我</span>
                </a>
            </li>
            
        </ul>
    </div>
    <div class="mobile-header-tag-container">
        <span class="title">Tags</span>
        <div id="mobile-header-container-tags">
            <a href="/tags/Java/" style="font-size: 10px;">Java</a> <a href="/tags/acm/" style="font-size: 12.86px;">acm</a> <a href="/tags/android/" style="font-size: 11.43px;">android</a> <a href="/tags/c/" style="font-size: 14.29px;">c++</a> <a href="/tags/fabric/" style="font-size: 11.43px;">fabric</a> <a href="/tags/kali/" style="font-size: 10px;">kali</a> <a href="/tags/linux/" style="font-size: 15.71px;">linux</a> <a href="/tags/linux学习/" style="font-size: 10px;">linux学习</a> <a href="/tags/mac/" style="font-size: 10px;">mac</a> <a href="/tags/mfc/" style="font-size: 10px;">mfc</a> <a href="/tags/onlinejudge/" style="font-size: 10px;">onlinejudge</a> <a href="/tags/sqlite/" style="font-size: 10px;">sqlite</a> <a href="/tags/sqlite3/" style="font-size: 11.43px;">sqlite3</a> <a href="/tags/ss/" style="font-size: 10px;">ss</a> <a href="/tags/vs/" style="font-size: 11.43px;">vs</a> <a href="/tags/xposed/" style="font-size: 10px;">xposed</a> <a href="/tags/xposed模块/" style="font-size: 10px;">xposed模块</a> <a href="/tags/专业知识/" style="font-size: 10px;">专业知识</a> <a href="/tags/侧链/" style="font-size: 10px;">侧链</a> <a href="/tags/内网穿透/" style="font-size: 10px;">内网穿透</a> <a href="/tags/区块链/" style="font-size: 11.43px;">区块链</a> <a href="/tags/复习/" style="font-size: 10px;">复习</a> <a href="/tags/学习/" style="font-size: 18.57px;">学习</a> <a href="/tags/安卓/" style="font-size: 12.86px;">安卓</a> <a href="/tags/小技巧/" style="font-size: 17.14px;">小技巧</a> <a href="/tags/数据库/" style="font-size: 10px;">数据库</a> <a href="/tags/数据结构/" style="font-size: 10px;">数据结构</a> <a href="/tags/日常使用问题/" style="font-size: 10px;">日常使用问题</a> <a href="/tags/最小生成树/" style="font-size: 11.43px;">最小生成树</a> <a href="/tags/最短路径/" style="font-size: 10px;">最短路径</a> <a href="/tags/比特币/" style="font-size: 11.43px;">比特币</a> <a href="/tags/算法/" style="font-size: 12.86px;">算法</a> <a href="/tags/算法笔记/" style="font-size: 11.43px;">算法笔记</a> <a href="/tags/经验/" style="font-size: 20px;">经验</a> <a href="/tags/编译原理/" style="font-size: 10px;">编译原理</a> <a href="/tags/翻译/" style="font-size: 10px;">翻译</a> <a href="/tags/自然计算/" style="font-size: 10px;">自然计算</a>
        </div>
    </div>
</div>
<div class="search-wrap">
    <span class="search-close">&times;</span>
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
            <i class="icon icon-lg icon-chevron-left"></i>
        </a>
        <input class="search-field" placeholder="Search..." id="keywords">
        <a id="search-submit" href="javascript:;">
            <i class="fa fa-search"></i>
        </a>
    <div class="search-container" id="search-container">
        <ul class="search-result" id="search-result">
        </ul>
    </div>
</div>

<div id="search-tpl">
    <li class="search-result-item">
        <a href="{url}" class="search-item-li">
            <span class="search-item-li-title" title="{title}">{title}</span>
        </a>
    </li>
</div>
<script src="/js/search.js"></script>
<script src="/js/main.js"></script>


  <script src="//cdn.bootcss.com/particles.js/2.0.0/particles.min.js"></script>
  <div id="particles"></div>
  <script src="/js/particles.js"></script>







  <link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.5.0/animate.min.css">
  <script src="//cdn.bootcss.com/scrollReveal.js/3.0.5/scrollreveal.js"></script>
  <script src="/js/animate.js"></script>


  <script src="/js/pop-img.js"></script>
  <script>
     $(".article-entry p img").popImg();
  </script>

  </div>
</body>
</html>